<template>
	<view class="content">
		<view class="input-content">
			<rich-text :nodes="info">
				
			</rich-text>
		</view>
		
	<!-- 	<view class="tips">
			<view class="tip_policy">
				<radio color='#90bbda' style="transform:scale(0.8)"  :checked="is_checked"></radio>
				<view class="policy_content">《意识协议说明书》</view>
			</view>
		</view> -->
		
		<view class="p-d-bottom" v-if="content_t!='' && content_t!='sign_rule'" @click="confirm">
			<view style="margin:16rpx 32rpx 0rpx 32rpx">
				<button  class="pay-btn">已同意以上{{policy_name}}</button>
			</view>
		</view>
	

	</view>
</template>

<script>
	import Api from '@/common/api';
	export default {
		data() {
			return {
				info:'',
				is_checked:true,
				content_t:'',
				policy_name:'',
				policy_obj:{
					'sign_rule':'签到规则',
					'privacy':'用户须知',
					'policy':'隐私政策',
					'ideology':'意识形态责任书'
				}
			}
		},
		
		onLoad(option){
			this.content_t =option.t
			this.loadRule();
			this.setButton();
		},
		methods: {
			
			async loadRule() {
				let params = {}
				let data = await Api.apiCall('get', Api.apiName.platform_resource, params, true);
				if (!data || data.code != 0) {
					return;
				}
				console.log(this.content_t)
				switch(this.content_t){
					case 'sign_rule':this.info = data.data.rule.sign_rule;break;
					case 'privacy':this.info = data.data.rule.privacy;break;
					case 'policy':this.info = data.data.rule.policy;break;
					default:this.info=data.data.rule.ideology;break;
				}
				
			},
			
			setButton(){
				switch(this.content_t){
					case 'sign_rule':this.policy_name=this.policy_obj.sign_rule;break;
					case 'privacy':this.policy_name=this.policy_obj.privacy;break;
					case 'policy':this.policy_name=this.policy_obj.policy;break;
					default:this.policy_name=this.policy_obj.ideology;break;
				}
				uni.setNavigationBarTitle({
					title:this.policy_name
				})
			},
			//提交
			confirm(){
					uni.navigateBack()
				},
				
		}
	}
</script>

<style lang="scss">
	page{
		background: $page-color-base;
		
	}
	.content{
		margin: 32rpx
		
	}
	.input-content{
		color:#000000;
		font-size: 26rpx;
	}
	
	.p-d-bottom{
		// border: 1px solid red;
		height: 140rpx;
		width: 100%;
		margin-top: 100rpx;
	}
	.pay-btn{
		color:#ffffff;
		width: 100%;
		background:#319eec;
		height: 84rpx;
		border-radius: 12rpx; 
	}
	.title{
		color: #fff;
		height: 70rpx;
		line-height: 70rpx;
		text-align: center;
		border-radius: 12rpx;
		background: #90bbda;
	}
	
	.tips{
		
	}
	
	.tip_title{
		color:#333333;
		font-size: 26rpx;
		padding: 12rpx;
	}
	
	.tip_policy{
		display: flex;
		justify-content: center;
		margin-top: 120rpx;
	}
	.policy_content{
		font-size: 13px;
		height: 26px;
		line-height: 26px;
		background: #90bbda;
		border-radius: 18rpx;
		padding: 0rpx 20rpx;
		color: #fff;
		opacity: 0.7;
	}
</style>
